package com.jiang.factory;

import com.jiang.proxy.ServiceProxy;

/**
 * @业务层工厂类
 * @author Administrator
 *
 */
public class ServiceFactory {

	private ServiceFactory() {

	}

	@SuppressWarnings("unchecked")
	public static <T> T getInstance(Class<T> clz) {

		T t = null;
		try {
			// 实际上是返回实体类的代理对象
			t = (T) new ServiceProxy().bind(clz.newInstance());
		
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		}
		return t;

	}

}
